"""
Case Type   : show collation
Case Name   : 验证where语句结合like、not like查询
Create At   : 2024/10/25
Owner       : lonely-dance
Description :
    1.show collation结合like、not like查询
Expect      :
    1.成功
History     :
"""
import os
import unittest

from testcase.utils.CommonSH import CommonSH
from testcase.utils.Constant import Constant
from testcase.utils.Logger import Logger
from yat.test import Node
from yat.test import macro


class ShowCollation(unittest.TestCase):
    def setUp(self):
        self.log = Logger()
        self.log.info(f'----{os.path.basename(__file__)} start----')
        self.pri_b_sh = CommonSH('PrimaryDbBmode')
        self.constant = Constant()

    def test_show_collation(self):
        text = '-----step1:show collation结合like、not like查询 expect:查询成功-----'
        self.log.info(text)
        cmd = """
            show collation where "collation" like 'aa_DJ';
            show collation where "collation" like 'aa_%';
            show collation where "collation" not like 'a%';
        """
        self.log.info(cmd)
        res = self.pri_b_sh.execut_db_sql(cmd)
        self.log.info(res)
        self.assertTrue('ERROR' not in res, '执行失败' + text)

    def tearDown(self):
        self.log.info(f'----{os.path.basename(__file__)} end----')
